PROGRAM_NAME='proc_mon_sys'
/*
 * Copyright 2010 Spire Integrated Systems, Inc.
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 * 
 * 	http://www.apache.org/licenses/LICENSE-2.0
 * 
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions
 *  and limitations under the License. 
 *  
 *  File: proc_mon_sys.axi
 *  Description: 
 * 		This include file implements the main module and creates a 
 *		function to submit status messages to the main server. The
 *		Event Types are defined on the web server and must match 
 *		accordingly. 
 */
define_constant
(*******************)
(* Event Types     *)
(*******************)

integer ET_PowerOn = 27;
integer ET_PowerOff = 28;
integer ET_DelayedResponse = 201;
integer ET_NoResponse = 202;
integer ET_ResendData = 203;
integer ET_UnknownMessage = 204;
integer ET_CommFailStd	=	205;
integer ET_CommFailEmergency	=	206;
integer ET_Docked = 301;
integer ET_Undocked = 302;
integer ET_AlarmSecurity = 401;
integer ET_AlarmFire = 402;
integer ET_AlarmHighTemp = 403;
integer ET_AlarmLowTemp = 404;
integer ET_AlarmFanFail = 405;
integer ET_FailEssentialEquipment = 406;
integer ET_FailNonessentialEquipment = 407;
integer ET_FailACPower = 408;
integer ET_BatteryLevelChange = 409;
integer ET_FilterChangeRequired = 410;
integer ET_BulbNeeded = 411;
integer ET_CodeFailure = 501;
integer ET_InputChanged = 601;
integer ET_UserChanged = 602;
integer ET_AlarmArmedAway = 603;
integer ET_AlarmArmedStay = 604;
integer ET_AlarmArmed = 605;
integer ET_AlarmDisarmed = 606;
integer ET_GoodByeActivated = 607;
integer ET_WelcomeActivated = 608;
integer ET_HelpPower = 801;//Power On Command issued from help page.
integer ET_HelpReboot = 802;//Device rebooted from help page.
integer ET_HelpService = 803;
integer ET_HelpPleaseCall = 804;
integer ET_Registered = 1001;
integer ET_Online = 1002;
integer ET_Offline = 1003;
integer ET_Sleep = 1004;
integer ET_Awake = 1005;
integer ET_Standby = 1006;
integer ET_IPChange = 2468;
integer ET_Heartbeat = 2469;

define_device
#WARN 'proc_mon_sys.axi - Make sure device numbers do not conflict.'
virt_proc_mon	= 0:20:0 //Do not use below port 4. Use the lowest free port over 4 to minimize memory usage.
dev_proc_mon 	= 33911:1:0

DEFINE_VARIABLE 

define_start
define_module 'proc_mon_sys_comm' mdlProcMon(virt_proc_mon,dev_proc_mon);

define_function send_status_msg(dev my_device,integer my_event, char my_message[40]){
	send_command virt_proc_Mon,"itoa(my_device.NUMBER),':',itoa(my_device.PORT),':',itoa(my_device.SYSTEM),'-',itoa(my_event),'-',my_message,'###'";
}
